/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package bank.core;

import bank.entries.AddInterest;
import bank.entries.Deposit;
import bank.entries.Withdrawal;
import bank.gui.BankFrm;
import card.core.AccountFactory;
import frmwrk.core.Account;
import frmwrk.core.CustomerFactory;
import frmwrk.core.Entry;
import frmwrk.core.FinancialFramework;
import frmwrk.interfaces.IAccount;
import frmwrk.interfaces.IEntry;
import frmwrk.interfaces.IParty;
import java.util.GregorianCalendar;
import java.util.HashMap;
import java.util.List;
import java.util.Observer;
import sun.java2d.loops.CustomComponent;

/**
 *
 * @author kgergis
 */
public class Bank extends FinancialFramework {

    private static BankFrm bankFrm;

    public static void main(String argsp[]) {
        bankFrm = new BankFrm(new Bank());
        bankFrm.setVisible(true);
    }

    public void addInterstForAllAccounts() {
        for (IAccount account : getAccounts()) {
            IEntry entry = new AddInterest(10d, new GregorianCalendar(), account);
            addAccountEntry(account, entry);
        }
    }

    public void addWithdrawalEntry(String accountNumber, double amount) {
        IAccount acc;
        acc = getAccount(Integer.parseInt(accountNumber));
        IEntry depositEntry = new Withdrawal(amount, new GregorianCalendar(), acc);
        addAccountEntry(acc, depositEntry);
    }

    public void addDepositEntry(String accountNumber, double amount) {
        IAccount acc;
        acc = getAccount(Integer.parseInt(accountNumber));
        IEntry depositEntry = new Deposit(amount, new GregorianCalendar(), acc);
        addAccountEntry(acc, depositEntry);
    }

}
